<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>广软课室申请后台管理系统</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" th:href="@{../x-admin/css/font.css}">
    <link rel="stylesheet" th:href="@{../x-admin/css/xadmin.css}">
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script th:src="@{../x-admin/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{../x-admin/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script th:src="@{https://cdn.staticfile.org/html5shiv/r29/html5.min.js}"></script>
    <script th:src="@{https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js}"></script>
    <![endif]-->
    <script>
        // 是否开启刷新记忆tab功能
        // var is_remember = false;
    </script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>申请人</th>
                            <th>用途</th>
                            <th>课室</th>
                            <th>星期</th>
                            <th>节次</th>
                            <th>信息时间</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                            <tr th:each="message,messageStat :${tumessages}">
                                <td><p th:text="${messageStat.index+1}"></p></td>
                                <td><p th:text="${message.account}"></p></td>
                                <td><p th:text="${message.reason}"></p></td>
                                <td><p th:text="${message.roomId}"></p></td>
                                <td><p th:text="${message.weekId}"></p></td>
                                <td><p th:text="${message.timeId}"></p></td>
                                <td><p th:text="${message.date}"></p> </td>
                                <td class="td-manage">
                                    <a th:href="|javascript:approval('${message.id}','${message.account}')|">
                                        <span class="layui-btn layui-btn-danger layui-btn-mini">批准</span>
                                    </a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div id="page">
                            <a class="prev" th:if="${pageInfo.pageNum!=1}" th:href="@{/admin/toUnReadMessage/(pageNum=1)}"
                               aria-label="Previous">首页</a>
                            <a class="prev" th:if="${pageInfo.pageNum!=1}"
                               th:href="@{/admin/toUnReadMessage/(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:${pageInfo.pages})}"
                               aria-label="Previous">上一页</a>
                            <a class="next" th:text="第+${pageInfo.pageNum}+页"></a>
                            <a class="next" th:text="共+${pageInfo.pages}+页"></a>
                            <a class="next" th:if="${pageInfo.pageNum != pageInfo.pages}"
                               th:href="@{/admin/toUnReadMessage/(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}"
                               aria-label="Next">下一页</a>
                            <a class="next" th:if="${pageInfo.pageNum != pageInfo.pages}"
                               th:href="@{/admin/toUnReadMessage/(pageNum=${pageInfo.pages})}" aria-label="Next">尾页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function approval(id, account) {
        let url = "/admin/isApproval?id=" + id;
        $.ajax({
            url: url,
            type: "POST",
            success: function (res) {
                if (res > 0) {
                    alert("你已批准" + account + "的申请");
                    xadmin.father_reload()
                }
            }
        })
    }
</script>
</html>
